package com.wang.gallerybackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wang.gallerybackend.api.aliyunai.model.CreateOutPaintingTaskRequest;
import com.wang.gallerybackend.api.aliyunai.model.CreateOutPaintingTaskResponse;
import com.wang.gallerybackend.model.dto.file.UploadPictureResult;
import com.wang.gallerybackend.model.dto.picture.*;
import com.wang.gallerybackend.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.wang.gallerybackend.model.entity.User;
import com.wang.gallerybackend.model.vo.PictureVO;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author 汪
 * @description 针对表【picture(图片信息表)】的数据库操作Service
 * @createDate 2025-08-07 11:56:10
 */
public interface PictureService extends IService<Picture> {
	/**
	 * 校验图片
	 * @param picture
	 */
	void validPicture(Picture picture);

	/**
	 * 上传图片
	 * @param inputSource 图片源
	 * @param pictureUploadDTO
	 * @param loginUser
	 * @return
	 */
	PictureVO uploadPicture(Object inputSource, PictureUploadDTO pictureUploadDTO, User loginUser);

	/**
	 * 获取查询对象
	 *
	 * @param pictureQueryRequest
	 * @return
	 */
	QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

	/**
	 * 获取图片封装
	 * @param picture
	 * @param request
	 * @return
	 */
	PictureVO getPictureVO(Picture picture, HttpServletRequest request);

	/**
	 * 分页获取图片封装
	 * @param picturePage
	 * @param request
	 * @return
	 */
	Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

	/**
	 * 编辑图片
	 * @param pictureEditRequest
	 * @param loginUser
	 */
	void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

	/**
	 * 图片审核
	 * @param pictureReviewRequest
	 * @param loginUser
	 */
	void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);

	/**
	 * 填充审核参数
	 * @param picture
	 * @param loginUser
	 */
	void fillReviewParams(Picture picture, User loginUser);

	/**
	 * 批量上传图片
	 * @param pictureUploadByBatchRequest
	 * @param loginUser
	 * @return 批量上传图片数量
	 */
	Integer uploadPictureByBitch(PictureUploadByBatchRequest pictureUploadByBatchRequest, User loginUser);

	/**
	 * 清理图片文件
	 * @param oldPicture 旧图片
	 */
	void clearPictureFile(Picture oldPicture);

	/**
	 * 检查图片权限
	 * @param loginUser
	 * @param picture
	 */
	void checkPictureAuth(Picture picture, User loginUser);

	/**
	 * 删除图片
	 * @param pictureId
	 * @param loginUser
	 */
	void deletePicture(long pictureId, User loginUser);

	/**
	 *
	 * 以颜色搜图
	 * @param spaceId
	 * @param picColor
	 * @param loginUser
	 * @return
	 */
	List<PictureVO> searchPictureByColor(Long spaceId, String picColor, User loginUser);

	/**
	 * 批量编辑图片
	 *
	 * @param pictureEditByBatchRequest
	 * @param loginUser
	 */
	void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, User loginUser);
	/**
	 * 创建扩图任务
	 *
	 * @param createPictureOutPaintingTaskRequest
	 * @param loginUser
	 */
	CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);
}
